import 'package:flutter/material.dart';

/// 主题资源管理类
/// 用于管理主题相关的资源，包括颜色和图片
class ThemeResources {
  /// 构造函数
  const ThemeResources({
    required this.brightness,
    required this.colors,
    required this.images,
  });

  /// 主题亮度
  final Brightness brightness;

  /// 主题颜色
  final ThemeColors colors;

  /// 主题图片
  final ThemeImages images;

  /// 是否是暗黑模式
  bool get isDarkMode => brightness == Brightness.dark;

  /// 亮色主题资源
  static const ThemeResources light = ThemeResources(
    brightness: Brightness.light,
    colors: ThemeColors.light,
    images: ThemeImages.light,
  );

  /// 暗色主题资源
  static const ThemeResources dark = ThemeResources(
    brightness: Brightness.dark,
    colors: ThemeColors.dark,
    images: ThemeImages.dark,
  );
}

/// 主题颜色
/// 用于管理主题相关的颜色
class ThemeColors {
  /// 构造函数
  const ThemeColors({
    required this.primaryColor,
    required this.appBarBackgroundColor,
    required this.appBarIconColor,
    required this.appBarTitleColor,
    required this.cursorColor,
    required this.scaffoldBackgroundColor,
    required this.titleColor1,
    required this.titleColor2,
    required this.titleColor3,
    required this.cardBackgroundColor,
    required this.dividerColor,
  });

  /// 主题色
  final Color primaryColor;

  /// 导航栏背景颜色
  final Color appBarBackgroundColor;

  /// 导航栏图标颜色
  final Color appBarIconColor;

  /// 导航栏标题颜色
  final Color appBarTitleColor;

  /// 光标颜色
  final Color cursorColor;

  /// 背景颜色
  final Color scaffoldBackgroundColor;

  /// 一级字体颜色
  final Color titleColor1;

  /// 二级字体颜色
  final Color titleColor2;

  /// 三级字体颜色
  final Color titleColor3;

  /// 卡片背景颜色
  final Color cardBackgroundColor;

  /// 分割线颜色
  final Color dividerColor;

  /// 亮色主题颜色
  static const ThemeColors light = ThemeColors(
    primaryColor: Colors.red,
    appBarBackgroundColor: Colors.white,
    appBarIconColor: Colors.black,
    appBarTitleColor: Colors.black,
    cursorColor: Color.fromRGBO(18, 18, 18, 1),
    scaffoldBackgroundColor: Colors.white,
    titleColor1: Colors.black,
    titleColor2: Color.fromRGBO(0, 0, 0, 0.8),
    titleColor3: Color.fromRGBO(0, 0, 0, 0.6),
    cardBackgroundColor: Colors.white,
    dividerColor: Color.fromRGBO(0, 0, 0, 0.1),
  );

  /// 暗色主题颜色
  static const ThemeColors dark = ThemeColors(
    primaryColor: Colors.red,
    appBarBackgroundColor: Color.fromRGBO(18, 18, 18, 1),
    appBarIconColor: Colors.white,
    appBarTitleColor: Colors.white,
    cursorColor: Color.fromRGBO(255, 255, 255, 0.8),
    scaffoldBackgroundColor: Color.fromRGBO(18, 18, 18, 1),
    titleColor1: Colors.white,
    titleColor2: Color.fromRGBO(255, 255, 255, 0.8),
    titleColor3: Color.fromRGBO(255, 255, 255, 0.6),
    cardBackgroundColor: Color.fromRGBO(30, 30, 30, 1),
    dividerColor: Color.fromRGBO(255, 255, 255, 0.1),
  );
}

/// 主题图片
/// 用于管理主题相关的图片
class ThemeImages {
  /// 构造函数
  const ThemeImages({
    required this.navBg,
  });

  /// 应用Logo
  final String navBg;

  /// 亮色主题图片
  static const ThemeImages light = ThemeImages(
    navBg: 'assets/images/light/nav.png',
  );

  /// 暗色主题图片
  static const ThemeImages dark = ThemeImages(
    navBg: 'assets/images/dark/nav.png',
  );
}
